import java.util.LinkedList;


public class test2
{

   /**
    * @param args
    */
   public static void main(String[] args)
   {
      LinkedList<String> list = new LinkedList<String>();
      list.add("hello");
      list.add("lamba");
      list.add("hw");
      System.out.println(list);
      list.addFirst("first");
      System.out.println(list);
      list.add(2, "second");
      System.out.println(list);
      list.addLast("last");
      System.out.println(list);
      list.add(5, "fifth");
      System.out.println(list);
      System.out.println(list.getFirst());
      System.out.println(list.getLast());
      System.out.println(list.indexOf("hw"));
      list.add("lastlast");
      System.out.println(list);

      System.out.println(list.lastIndexOf("second"));
      
      System.out.println(list.get(2));
      System.out.println(list.listIterator(0).next());
   }

}
